#include <iostream>

using namespace std;


class A
{
public:
    virtual ~A()
    {
        cout << "~A()" << endl;
    }
};

class B : public A
{
public:
    ~B()
    {
        cout << "~B()" << endl;
    }
};
int main()
{
    A* a = new A;
    A* b = new B;
    delete a;
    delete b;
    return 0;
}